package com.hstcs.systmes;

import com.badlogic.ashley.core.ComponentMapper;
import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.systems.IteratingSystem;
import com.hstcs.components.CrosshairComponent;
import com.hstcs.components.StateComponent;
import com.hstcs.components.TimeEventComponent;

import com.hstcs.creator.TimeEventCreator;
import com.hstcs.game.God;


public class TimeLineSystem extends IteratingSystem {
//	private ComponentMapper<TimeEventComponent> tm;
	static public int EVENT_CREATE_MONSTER = 0;
	
	int step = 1;
	float  lineTime = 0;
	float stepTime = 0;
	public TimeLineSystem() {
		super(Family.all(TimeEventComponent.class).get());
		// TODO Auto-generated constructor stub
	}
	
	public void update(float deltaTime){
		
		lineTime += deltaTime;
		super.update(deltaTime);
		
	}

	@Override
	protected void processEntity(Entity entity, float deltaTime) {
		// TODO Auto-generated method stub
		//System.out.println("linetime:" + lineTime +"  " + deltaTime);
		TimeEventComponent tc =  entity.getComponent(TimeEventComponent.class);
		if(tc.isFinish ==false && tc.time < lineTime){
			System.out.println("time is:" +tc.time + "use:" + lineTime);
			processEvent(tc);
		}
		
	}
	
	public void processEvent(TimeEventComponent te){
		
		if(te.type ==TimeEventCreator._Monster)
		{
			//MonsterCreator.createMonster();
			te.isFinish = true;
		}
		
	}

}
